// 详情页顶部轮播
var mySwiper = new Swiper('.goodsDetailsRolePic', {
  // autoplay: true,//可选选项，自动滑动
  pagination: {
    el: '.swiper-pagination',
  },
})

//详情页底部商品组合
var mySwiper1 = new Swiper('.goodsGroupingRole', {
  // autoplay: true,//可选选项，自动滑动
  freeMode: true,
  freeModeMomentum: false,
})

//详情页
$.ajax({
  type: 'get', //get或post
  url: 'http://tggw.didu86.com/api/goodsDedail?goodsId=1', //请求的地址
  data: {}, //如果不需要传，则注释掉 请求的参数，a=1&b=2或{a:1,b:2}或者jq中的serialize方法，或者formData收集
  dataType: 'json', //text,json,xml,jsonp
  success: function (res) { //成功的回调函数
    console.log(res)
    var data = jm(res.data)
    data = JSON.parse(data.replace(/[\\]/g, ''));
    console.log(data.goods);
    var goods = data.goods
    //商品价格
    var floatCount = goods.price.substr(goods.price.indexOf('.'));
    var count = goods.price.substr(0,goods.price.indexOf('.'))
    $('#float').text(floatCount)
    $('#price').text(count)
    //商品名称
    var goodsName = goods.goodsName
    $('#goodsName').text(goodsName)
    //商品点赞
    var like = goods.like
    $('#like').text(like)
    //商品销量
    var sold = goods.sold
    $('#sold').text(sold)
  }
})

// 尺码颜色界面弹出
$('#sizeColorSelect').click(function () {
  $('.specificationList').css('display', 'block')
  $(".marsk-container").toggle();
})
//尺码颜色界面关闭
$('.close').click(function () {
  $('.specificationList').css('display', 'none')
  $(".marsk-container").toggle();
})